package tjs.study.notes.dotest.jvm.heap;

import jodd.util.ThreadUtil;
import tjs.study.notes.base.common.ThreadUtils;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by Nicky.Tang on 2022/11/15 上午11:39
 *
 * @since 02.12.10
 */
public class 测试快速GC {
    public static void doTask() {
        byte[] param = new byte[10];
        ThreadUtil.sleep(1000);
        System.out.println(param.length);
    }

    public static void main(String[] args) {
        List<Runnable> tasks = new ArrayList<>(1000);
        for (int i = 0; i < 1000; i++) {
            int finalI = i;
            tasks.add(() -> {
                System.out.println("开始" + finalI);
                doTask();
                System.out.println("结束" + finalI);
            });
        }
        ThreadUtils.run(ThreadUtils.getOne(), tasks);
        System.out.println("结束");
    }

}
